home *** CD-ROM | disk | FTP | other *** search
- /* NOPAUSE.CPP - Disable Pause.
- (C) Copyright 1991
- By Thomas Astin CIS: 73407,3427 Prodigy: RNVN08A
- All rights reserved. */
-
- /* Disable pause by intercepting interrupt 9 and blocking pause scan codes.*/
-
- /* NOTE: This program worked fine on the machine upon which it was
- developed and tested. Use at your own risk. The author is
- not responsible for any damage, system failure, or the like
- as a result of executing this code.
-
- Compiles under Borland C++. Code may require modifications for
- use with other compilers.
- */
-
-
- #include <dos.h>
- #include <stdio.h>
-
- /* Protos */
- void interrupt NewInt9(...);
- void ExitFunc(void);
-
- /* exit func in case ^C */
- #pragma exit ExitFunc
-
- /* Defines */
- #define KbdIn 0x60
- #define KbdCtl 0x61
- #define MaxChkIdx 3
-
- /* Globals */
- unsigned char ChkArray[MaxChkIdx] = {0xE1,0x1D,0x45};
- unsigned char ChkIdx=0;
- unsigned char CurScan=0;
- void interrupt (*OldInt9)(...)=NULL;
-
- main(void)
- {
- int num=0;
-
- OldInt9=getvect(9); // grab keyboard int 9
- setvect(9,NewInt9); // point to ours
-
- while (CurScan!=0x01) // show off
- printf("Try to pause me %d\r",num++);
- return(0);
- }
-
- void interrupt NewInt9(...) // int 9 handler
- {
- CurScan=inportb(KbdIn); // get scan code
- if (CurScan==ChkArray[ChkIdx++]) { // check scan code array
- if (ChkIdx>=MaxChkIdx) { // last match?
- ChkIdx=0; // get ready for next time
-
- asm in al,KbdCtl // restore keyboard
- asm mov ah,al
- asm or al,80h
- asm jmp temp1
- temp1:
- asm out KbdCtl,al
- asm xchg ah,al
- asm jmp temp2
- temp2:
- asm out KbdCtl,al
- asm mov al,20h // Issue EOI
- asm out 20h,al
-
- return;
- }
- }
- else
- ChkIdx=0; // start over
-
- OldInt9(); // call original int 9
- }
-
- void ExitFunc(void)
- {
- if (OldInt9!=NULL)
- setvect(9,OldInt9); // restore int 9
- }